// 	ID : pallab81
// 	PROG : 10131
// 	LANG : C++
// 	2011-08-25-20.05.41 Thursday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,ed) for(int i = 0 ; i < ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )
#define mmk( x, y, z ) make_pair( x, make_pair( y, z ) )

inline void wait( double seconds ) {
    double endtime = clock() + ( seconds*CLOCKS_PER_SEC );
    while( clock() < endtime ) {
        ;
    }
}
vector< pair<int,pair<int,int> > > vt;
inline void Proc() {
    sort( vt.begin(), vt.end(), less< pair<int, pair<int,int> > >() );
    int N = SZ(vt);
    vector< int > lst;
    fo(i,N) {
        lst.pb(1);
    }

    for(int i=1; i<N; ++i ) {
        int W = vt[i].first;
        int S = vt[i].second.first;
        for(int j=0; j<i; ++j) {
            int W1 = vt[i].first;
            int W2 = vt[j].first;
            int S1 = vt[i].second.first;
            int S2 = vt[j].second.first;

            if( W1 > W2 && S1 < S2 && (lst[i] < lst[j]+1 ) ) {
                lst[i] = lst[j]+1;
            }
        }
    }
    int mx=-1;
    for(int i=0; i<N; ++i) {
        //cout<<lst[i]<<"\n";
        if( mx==-1 || mx < lst[i] )     {
            mx = lst[i];
        }
    }
    printf("%d\n",mx);
    stack<int> st;
    int i=N-1;
    while( i>=0 ){
           if( mx == lst[i] ){
               st.push( vt[i].second.second );
               while( i>=0 && mx==lst[i]){
                      --i;
               }
               --mx;
           }
           else{
                --i;
           }
    }
    while(st.empty()==false ){
        printf("%d\n",st.top());
        st.pop();
    }
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt","rt",stdin);
#endif
    int S_,W_;
    int i=1;
    while( scanf("%d %d",&W_,&S_) == 2 ) {
        vt.pb( mmk(W_,S_,i) );
        ++i;
    }
    Proc();
    return 0;
}
